package com.cloudptt.api.pjsua2.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;

import com.cloudptt.api.pjsua2.api.IKeepAliveService;
import com.cloudptt.api.product.log.Log;

public class KeepAliveService  extends Service {
    private static final String THIS_FILE = "KeepAliveService";
//    private SipWakeLock sipWakeLock;
    @Override
    public void onCreate() {
        super.onCreate();
//        sipWakeLock = new SipWakeLock((PowerManager) getSystemService(Context.POWER_SERVICE));
    }
    @Override
    public void onStart(Intent intent, int startId)
    {
        super.onStart(intent, startId);
        Log.d(THIS_FILE, "onStart");
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.d(THIS_FILE, "onStartCommand");
        return super.onStartCommand(intent, flags, startId);
    }

    @Override
    public IBinder onBind(Intent intent)
    {
        // TODO Auto-generated method stub
        Log.d(THIS_FILE, "onBind");
        String serviceName = intent.getAction();
        Log.d(THIS_FILE, "onBind Action is " + serviceName);
        return binder;
    }
    @Override
    public boolean onUnbind(Intent intent) {
        // TODO Auto-generated method stub
        Log.d(THIS_FILE, "onUnbind");
        return super.onUnbind(intent);
    }
    @Override
    public void onRebind(Intent intent)
    {
        // TODO Auto-generated method stub
        Log.d(THIS_FILE, "onRebind");
        super.onUnbind(intent);
    }
    @Override
    public void onLowMemory() {
        // TODO Auto-generated method stub
        super.onLowMemory();
        Log.d(THIS_FILE, "onLowMemory");
    }

    @Override
    public void onTrimMemory(int level) {
        // TODO Auto-generated method stub
        super.onTrimMemory(level);
        Log.d(THIS_FILE, "onTrimMemory level = " + level);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.e(THIS_FILE, "onDestroy");
        //sipWakeLock.release();
    }
    private final IKeepAliveService.Stub binder = new IKeepAliveService.Stub() {

        @Override
        public int getVersion() throws RemoteException {
            return 0;
        }
    };
}
